let now = new Date();
let year = now.getFullYear();
let month = now.getMonth()+1;
let date = now.getDate();
let hours = now.getHours();
let minutes = now.getMinutes();
let seconds = now.getSeconds();

year = numFromat(year,4);
month = numFromat(month,2);
date = numFromat(date,2);
hours = numFromat(hours,2);
minutes = numFromat(minutes,2);
seconds = numFromat(seconds,2);

console.log(year+"-"+month+"-"+date+" "+hours +":"+minutes +":"+seconds);

function numFromat(num,intd=0) {  
    num = num + "";
    for (let i = num.length; i < intd; i++) {
        num = "0"+num;
    }
    return num;
}

